package com.bookdemo.service.impl;

import com.bookdemo.dao.BookDao;
import com.bookdemo.pojo.Books;
import com.bookdemo.pojo.User;
import com.bookdemo.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author zhu
 *
 */
@Service
public class BookServiceImpl implements BookService {
    @Autowired
    BookDao bookDao;
    @Override
    public List<Books> getBooks() {
        List<Books> books = bookDao.getBooks();
        return books;
    }

    @Override
    public int addBook(Books books) {
        return bookDao.addBook(books);
    }

    @Override
    public int deleteBook(int id) {
        return bookDao.deleteBook(id);
    }

    @Override
    public int editBook(Books books) {
        int i = bookDao.editBook(books);
        return i;

    }

    @Override
    public Books getUpdateBook(int id) {
        Books updateBook = bookDao.getUpdateBook(id);
        return updateBook;
    }

    @Override
    public List<Books> selectBook(String bookName) {
        List<Books> books = bookDao.selectBook(bookName);
        return books;
    }
}
